#!/bin/bash
docker run -d --name node1 -h node1 progrium/consul -server -bootstrap-expect 3
JOIN_IP=$(docker inspect -f '{{ .NetworkSettings.IPAddress }}' node1)
docker run -d --name node2 -h node2 progrium/consul -server -join $JOIN_IP
docker run -d --name node3 -h node3 progrium/consul -server -join $JOIN_IP
docker run -d -p 9107:9107 --dns=172.17.0.1 --dns-search=service.consul \
        prom/consul-exporter --consul.server=consul:8500